package org.jeecg.common.util.page;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;

import java.util.List;

/**
 * @Author ： Mr Liu
 * @Date ： 2019/5/9 23:52
 * @Description ： 分页结果类
 */
@ApiModel
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Page<T> {

    @ApiModelProperty(name = "totalCount", value = "总行数")
    private Long totalCount;

    @ApiModelProperty(name = "list", value = "数据")
    private List<T> list;

    public static <E> Page pageInfo(@NonNull Long total, @NonNull List<E> dataList){

        Page<E> page = new Page<>();
        page.totalCount = total;
        page.list = dataList;
        return page;
    }
}
